package cn.com.code.hwjs;

import java.util.*;

/**
 * @author zhengpei
 * https://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68?tpId=37&tqId=21250&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fdifficulty%3D3%26page%3D1%26pageSize%3D50%26search%3D%26tpId%3D37%26type%3D37&difficulty=3&judgeStatus=undefined&tags=&title=
 * @date 2022/4/23
 */
public class Hwjs27 {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    while (sc.hasNext()) {
      String[] array = sc.nextLine().split(" ");
      // 字典长度
      int dicLen = Integer.parseInt(array[0]);
      // 参数单词
      String word = array[array.length - 2];
      // 需要输出第？个单词 1
      int k = Integer.parseInt(array[array.length - 1]);
      List<String> list = new ArrayList<>();
      for (int i = 0; i <= dicLen; i++) {
        if (isBrother(word, array[i])) {
          list.add(array[i]);
        }
      }
      System.out.println(list.size());
      if (list.size() >= k) {
        Collections.sort(list);
        System.out.print(list.get(k - 1));
      }

    }

  }

  private static boolean isBrother(String argWord, String word) {
    // 校验 相同的单词 长度不一致的 不是兄弟单词
    if (argWord.length()!=word.length()||argWord.equals(word)){
      return false;
    }
    char[] chars = argWord.toCharArray();
    char[] chars1 = word.toCharArray();
    Arrays.sort(chars);
    Arrays.sort(chars1);
    return Arrays.equals(chars, chars1);
  }

}
